﻿using Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Teacher
{
    public partial class login : Form
    {
        public login()
        {
            InitializeComponent();
        }



    
        private void show_cursor(object sender, EventArgs e)//
        {
            tea_name_box.Focus();//
        }

        private void textBox1_MouseEnter(object sender, EventArgs e)
        {
            tea_name_box.Focus();//
        }

        private void textBox2_MouseEnter(object sender, EventArgs e)
        {
            tea_pwd_box.Focus();//
        }

        private void login_t_Click_1(object sender, EventArgs e)
        {
            Model.Teacher teacher = new Model.Teacher();
            teacher.teacher_uname = this.tea_name_box.Text;
            teacher.pwd = this.tea_pwd_box.Text;//model模块完成

            BLL.B_Teacher b_Teacher = new BLL.B_Teacher();
            bool res = b_Teacher.Login(teacher);
            if (res)
            {
                this.DialogResult = DialogResult.OK;
                MessageBox.Show("账号密码正确，登录成功");
            }
            else
            {
                MessageBox.Show("密码或用户名有误", "消息提示框", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);//
                tea_name_box.Text = "";//置空
                tea_pwd_box.Text = "";//置空
                tea_name_box.Focus();//光标回到用户输入栏
            }
        }

        private void login_Load(object sender, EventArgs e)
        {

        }
    }
}